﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

namespace OptiGear1
{
    public class WeightProfile
    {
        public string name;
        public int targetHit;
        public double spellpower;
        public double haste;
        public double crit;
        public double spirit;
        public double intel;
        public double stamina;
        public double lostHit;
        public double t7_2pc;
        public double t7_4pc;
        public double t8_2pc;
        public double t8_4pc;
        public double t9_2pc;
        public double t9_4pc;
        public double t10_2pc;
        public double t10_4pc;
        public bool includeT7;
        public bool includeT8;
        public bool includeT9;
        public bool includeT10;
        public bool forceHit;

        public WeightProfile()
        {
        }

        public static List<WeightProfile> Deserialize(string fileName)
        {
            XmlSerializer mySerializer = new XmlSerializer(typeof(List<WeightProfile>));
            FileStream myFileStream = new FileStream(fileName, FileMode.Open);
            List<WeightProfile> profiles = (List<WeightProfile>)mySerializer.Deserialize(myFileStream);
            myFileStream.Close();
            return profiles;
        }

        public static void Serialize(List<WeightProfile> profiles, string fileName)
        {
            XmlSerializer s = new XmlSerializer(typeof(List<WeightProfile>));
            TextWriter wr = new StreamWriter(fileName);
            s.Serialize(wr, profiles);
            wr.Close();
        }

    }
}
